package com.aaa.marketresearch.dataresource.service;

import com.aaa.marketresearch.dataresource.dao.FamilyMemberDAO;
import com.aaa.marketresearch.dataresource.domain.FamilyMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Nail
 */

@Service
public class FamilyMemberServiceImpl implements FamilyMemberService {

    @Autowired
    private FamilyMemberDAO familyMemberDAO;

    @Override
    public List<FamilyMember> getAllForFamily(Integer familyId) {
        return familyMemberDAO.getAllForFamily(familyId);
    }

    @Override
    public FamilyMember getById(Integer id) {
        return familyMemberDAO.getById(id);
    }

    @Override
    public List<String> getProfessions(String part) {
        return familyMemberDAO.getProfessions(part);
    }

    @Transactional
    @Override
    public void save(FamilyMember familyMember) {
        familyMemberDAO.save(familyMember);
    }

    @Transactional
    @Override
    public boolean delete(Integer id) {
        return familyMemberDAO.delete(id);
    }
}